/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package org.jmresler.sakila.domain;

import jakarta.persistence.*;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@NoArgsConstructor
@Data
@Entity
@Table(schema = "sakila")
public class Film implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "film_id", nullable = false)
    private Short filmId;
    @Basic(optional = false)
    @Column(nullable = false, length = 128)
    private String title;
    @Lob
    @Column(length = 65535)
    private String description;
    @Column(name = "release_year")
    @Temporal(TemporalType.DATE)
    private Date releaseYear;
    @Basic(optional = false)
    @Column(name = "rental_duration", nullable = false)
    private short rentalDuration;
    @Basic(optional = false)
    @Column(name = "rental_rate", nullable = false, precision = 4, scale = 2)
    private BigDecimal rentalRate;
    private Short length;
    @Basic(optional = false)
    @Column(name = "replacement_cost", nullable = false, precision = 5, scale = 2)
    private BigDecimal replacementCost;
    @Column(length = 5)
    private String rating;
    @Column(name = "special_features", length = 54)
    private String specialFeatures;
    @Basic(optional = false)
    @Column(name = "last_update", nullable = false)
    @Temporal(TemporalType.TIMESTAMP)
    private Date lastUpdate;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "film")
    private List<FilmCategory> filmCategoryList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "film")
    private List<FilmActor> filmActorList;
    @JoinColumn(name = "language_id", referencedColumnName = "language_id", nullable = false)
    @ManyToOne(optional = false)
    private Language languageId;
    @JoinColumn(name = "original_language_id", referencedColumnName = "language_id")
    @ManyToOne
    private Language originalLanguageId;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "filmId")
    private List<Inventory> inventoryList;
}
